package aml.parse.node;

import aml.runtime.Context;
import aml.runtime.Value;
import aml.runtime.ValueRef;

public class OpAssign extends OpNode {
	@Override
	public int precedence() {
		return -1000000;
	}
	
	@Override
	public Value eval(Context ctx) {
		ValueRef ref = lhs.eref(ctx);
		Value value = rhs.eval(ctx);
		return ref.setValue(value);
	}
	
	@Override
	public ValueRef eref(Context ctx) {
		return (ValueRef) eval(ctx);
	}

	@Override
	public String toString() {
		return "(= " + lhs + " " + rhs + ")";
	}
}